package com.yj.ccs.abs.web.assetData.controller;

import com.yj.ccs.abs.boot.authorization.annotation.CurrentUser;
import com.yj.ccs.abs.boot.pagination.Page;
import com.yj.ccs.abs.common.model.BaseResult;
import com.yj.ccs.abs.web.assetData.dto.AreaAnalysisDto;
import com.yj.ccs.abs.web.assetData.dto.ConcentrationAnalysisDto;
import com.yj.ccs.abs.web.assetData.dto.PeriodDto;
import com.yj.ccs.abs.web.assetData.entity.*;
import com.yj.ccs.abs.web.assetData.service.AssetDataService;
import com.yj.ccs.abs.web.management.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhengguanyong on 2018/3/28.
 */
@Api(tags = "Web-AssetData-Controller")
@RestController
@RequestMapping("/web/assetData")
public class AssetDataController {

    @Autowired
    AssetDataService assetDataService;

    @ApiOperation(value = "获取期数",position = 1,notes =
                    "      \"period\": 期数,\n" +
                    "      \"start_date\": 开始日期,\n" +
                    "      \"end_date\": 结束日期")
    @GetMapping("/assetPeriods")
    public ResponseEntity<BaseResult> getAssetPeriods(@CurrentUser User user) {
        List<Periods> list = assetDataService.getAssetPeriods();

        return new ResponseEntity<>(BaseResult.success("获取期数,获取成功").setData(list), HttpStatus.OK);
    }

    @ApiOperation(value = "资产池数据",position = 1,notes =
                    "    @ApiModelProperty(value=\"存续合同数\")\n" +
                    "    private int existenceContract;\n" +
                    "    @ApiModelProperty(value=\"债务人\")\n" +
                    "    private int buyer;\n" +
                    "    @ApiModelProperty(value=\"基础资产笔数\")\n" +
                    "    private int countBaseAsset;\n" +
                    "    @ApiModelProperty(value=\"每债务人平均\")\n" +
                    "    private BigDecimal averageAsset;\n" +
                    "    @ApiModelProperty(value=\"应收帐款总金额\")\n" +
                    "    private BigDecimal sumAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"总金额单笔平均\")\n" +
                    "    private BigDecimal aveAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"应收账款余额\")\n" +
                    "    private BigDecimal sumAssetAvailableMoney;\n" +
                    "    @ApiModelProperty(value=\"余额单笔平均\")\n" +
                    "    private BigDecimal aveAssetAvailableMoney;\n" +
                    "    @ApiModelProperty(value=\"逾期资产金额\")\n" +
                    "    private BigDecimal sumOverdueAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"逾期比例\")\n" +
                    "    private BigDecimal overdueRate;\n" +
                    "    @ApiModelProperty(value=\"闲置资金金额\")\n" +
                    "    private BigDecimal sumUnusedAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"闲置比例\")\n" +
                    "    private BigDecimal unusedRate;")
    @GetMapping("/data/assetDataStatTotal")
    public ResponseEntity<BaseResult> assetDataStatTotal(@CurrentUser User user,int period) {
        AssetDataStat assetDataStat = assetDataService.assetDataStatTotal();

        return new ResponseEntity<>(BaseResult.success("资产池数据,获取成功").setData(assetDataStat), HttpStatus.OK);
    }

    @ApiOperation(value = "资产TOP5",position = 2,notes =
                    "      \"number\": 资产编号,\n" +
                    "      \"money_sum\": 应收总金额,\n" +
                    "      \"available_money\": 应收余额,\n" +
                    "      \"credit_day\": 应收账期,\n" +
                    "      \"remain_days\": 剩余期限")
    @GetMapping("/data/assetTop5")
    public ResponseEntity<BaseResult> assetTop5(@CurrentUser User user,int period) {
        List<AssetTop5> assetTop5List = assetDataService.assetTop5List();

        return new ResponseEntity<>(BaseResult.success("资产TOP5,获取成功").setData(assetTop5List), HttpStatus.OK);
    }

    @ApiOperation(value = "账期分析",position = 3,notes =
                    "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"remain_days\": 剩余期限,\n" +
                    "      \"credit_days\": 账期分布\n" +
                    "      -----------参数----------\n"+
                    "      type(1:剩余期限,2:账期分布)")
    @GetMapping("/data/billAnalysis")
    public ResponseEntity<BaseResult> billAnalysis(@CurrentUser User user, Integer type,int period) {
        switch (type) {
            case 1:
                List<BillAnalysis> billAnalysisList = assetDataService.billAnalysisList();
                return new ResponseEntity<>(BaseResult.success("剩余期限,获取成功").setData(billAnalysisList), HttpStatus.OK);
            case 2:
                List<BillAnalysis> billCycleList = assetDataService.billCycleList();
                return new ResponseEntity<>(BaseResult.success("账期分布,获取成功").setData(billCycleList), HttpStatus.OK);
            default:
                return new ResponseEntity<>(BaseResult.error("传参错误,传入的type为:"+type), HttpStatus.OK);
        }
    }

    @ApiOperation(value = "集中度分析",position = 3,notes =
                    "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"buyer\": 债务人,\n" +
                    "      \"seller\": 债权人,\n" +
                    "      \"parent_name\": 债务人母公司,\n" +
                    "      \"final_parent_name\": 终极母公司")
    @GetMapping("/data/concentrationAnalysis")
    public ResponseEntity<BaseResult> concentrationAnalysis(@CurrentUser User user, ConcentrationAnalysisDto concentrationAnalysisDto) {
        String name = "";
        switch (concentrationAnalysisDto.getType()) {
            case 1:name = "债务人";break;
            case 2:name = "债权人";break;
            case 3:name = "债务人母公司";break;
            case 4:name = "终极母公司";break;
        }
        return new ResponseEntity<>(BaseResult.success(name+",获取成功").setData(assetDataService.concentrationAnalysisPage(concentrationAnalysisDto)), HttpStatus.OK);

    }

    @ApiOperation(value = "地域分析",position = 3,notes =
            "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"province_name\": 省份")
    @GetMapping("/data/areaAnalysis")
    public ResponseEntity<BaseResult> areaAnalysis(@CurrentUser User user, AreaAnalysisDto areaAnalysisDto) {
        String name = "";
        switch (areaAnalysisDto.getType()) {
            case 1:name = "省份";break;
        }
        return new ResponseEntity<>(BaseResult.success(name+",获取成功").setData(assetDataService.areaAnalysisPage(areaAnalysisDto)), HttpStatus.OK);
    }

    @ApiOperation(value = "债务人分析",position = 3,notes =
                    "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"shadow_name\": 影子评级,\n" +
                    "      \"industry\": 所属行业\n" +
                    "      \"nature_name\": 公司性质\n" +
                    "      -----------参数----------\n"+
                    "      type(1:影子评级,2:所属行业,3:公司性质)")
    @GetMapping("/data/buyerAnalysis")
    public ResponseEntity<BaseResult> buyerAnalysis(@CurrentUser User user, Integer type,int period) {
        switch (type) {
            case 1:
                List<BillAnalysis> shadowAnalysis = assetDataService.shadowAnalysis();
                return new ResponseEntity<>(BaseResult.success("影子评级,获取成功").setData(shadowAnalysis), HttpStatus.OK);
            case 2:
                List<BillAnalysis> industryAnalysis = assetDataService.industryAnalysis();
                return new ResponseEntity<>(BaseResult.success("所属行业,获取成功").setData(industryAnalysis), HttpStatus.OK);
            case 3:
                List<BillAnalysis> natureAnalysis = assetDataService.natureAnalysis();
                return new ResponseEntity<>(BaseResult.success("公司性质,获取成功").setData(natureAnalysis), HttpStatus.OK);
            default:
                return new ResponseEntity<>(BaseResult.error("传参错误,传入的type为:"+type), HttpStatus.OK);
        }
    }

    @ApiOperation(value = "货物分析",position = 3,notes =
            "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"usage\": 用途,\n" +
                    "      \"goods_type\": 类型\n" +
                    "      \"transport_type_name\": 运输方式\n" +
                    "      -----------参数----------\n"+
                    "      type(1:用途,2:类型,3:运输方式)")
    @GetMapping("/data/goodsAnalysis")
    public ResponseEntity<BaseResult> goodsAnalysis(@CurrentUser User user, Integer type,int period) {
        switch (type) {
            case 1:
                List<BillAnalysis> usageAnalysis = assetDataService.usageAnalysis();
                return new ResponseEntity<>(BaseResult.success("用途,获取成功").setData(usageAnalysis), HttpStatus.OK);
            case 2:
                List<BillAnalysis> goodsTypeAnalysis = assetDataService.goodsTypeAnalysis();
                return new ResponseEntity<>(BaseResult.success("类型,获取成功").setData(goodsTypeAnalysis), HttpStatus.OK);
            case 3:
                List<BillAnalysis> transportTypeAnalysis = assetDataService.transportTypeAnalysis();
                return new ResponseEntity<>(BaseResult.success("运输方式,获取成功").setData(transportTypeAnalysis), HttpStatus.OK);
            default:
                return new ResponseEntity<>(BaseResult.error("传参错误,传入的type为:"+type), HttpStatus.OK);
        }
    }

    @ApiOperation(value = "资产分析",position = 3,notes =
            "      -----------共同字段----------\n"+
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"level_name\": 风险分类,\n" +
                    "      \"guarantee_name\": 担保方式\n" +
                    "      \"is_settled_name\": 是否结算\n" +
                    "      \"accused_name\": 涉及诉讼\n" +
                    "      -----------参数----------\n"+
                    "      type(1:风险分类,2:担保方式,3:是否结算,4:涉及诉讼)")
    @GetMapping("/data/assetAnalysis")
    public ResponseEntity<BaseResult> assetAnalysis(@CurrentUser User user, Integer type,int period) {
        switch (type) {
            case 1:
                List<BillAnalysis> levelAnalysis = assetDataService.levelAnalysis();
                return new ResponseEntity<>(BaseResult.success("风险分类,获取成功").setData(levelAnalysis), HttpStatus.OK);
            case 2:
                List<BillAnalysis> guaranteeAnalysis = assetDataService.guaranteeAnalysis();
                return new ResponseEntity<>(BaseResult.success("担保方式,获取成功").setData(guaranteeAnalysis), HttpStatus.OK);
            case 3:
                List<BillAnalysis> isSettledAnalysis = assetDataService.isSettledAnalysis();
                return new ResponseEntity<>(BaseResult.success("是否结算,获取成功").setData(isSettledAnalysis), HttpStatus.OK);
            case 4:
                List<BillAnalysis> accusedAnalysis = assetDataService.accusedAnalysis();
                return new ResponseEntity<>(BaseResult.success("涉及诉讼,获取成功").setData(accusedAnalysis), HttpStatus.OK);
            default:
                return new ResponseEntity<>(BaseResult.error("传参错误,传入的type为:"+type), HttpStatus.OK);
        }
    }

    @ApiOperation(value = "循环购买",position = 3,notes =
                    "      \"cycle_amount\": 当期回收金额,\n" +
                    "      \"cycle_count\": 当期回收笔数,\n" +
                            "      \"accrual_fee\": 计提利息费用,\n" +
                            "      \"accrual_fee_beginning\": 上期计提利息费用,\n" +
                    "      \"can_cycle_buy_amount\": 可循环购买金额,\n" +
                    "      \"can_cycle_buy_amount_beginning\": 期初可循环购买金额,\n" +
                    "      \"cycle_buy_amount\": 循环购买金额,\n" +
                    "      \"cycle_buy_count\": 循环购买笔数,\n" +
                    "      \"cycle_amount_use_rate\": 回收款金额使用率,\n" +
                    "      \"cycle_amount_use_rate_beginning\": 上期回收金额使用率\n" +
                    "      \"unused_amount\": 闲置资金金额\n" +
                    "      \"unused_amount_rate\": 闲置比例" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/cycle/cycleBuying")
    public ResponseEntity<BaseResult> cycleBuying(@CurrentUser User user ,int period) {
        CycleBuying cycleBuying = new CycleBuying();

        return new ResponseEntity<>(BaseResult.success("循环购买,获取成功").setData(cycleBuying), HttpStatus.OK);
    }

    @ApiOperation(value = "当期回收",position = 3,notes =
                    "      \"number\": 编号,\n" +
                    "      \"buyer\": 债务人,\n" +
                    "      \"predict_date\": 应收账款日,\n" +
                    "      \"level\": 分级(1-正常 2-逾期 3-关注 4-次级 5-违约),\n" +
                    "      \"money_sum\": 回收款金额,\n" +
                    "      \"recycle_date\": 回收款日期\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/cycle/assetRecycle")
    public ResponseEntity<BaseResult> assetRecycle(@CurrentUser User user,PeriodDto periodDto) {
        AssetRecycle assetRecycle = new AssetRecycle();
        assetRecycle.setNumber("Ys20180811669");
        assetRecycle.setBuyer("湖南华润电力鲤鱼江");
//        assetRecycle.setLevel(1);
        assetRecycle.setPredict_date(LocalDate.now());
        assetRecycle.setMoney_sum(new BigDecimal(2422633.98));
        assetRecycle.setRecycle_date(LocalDate.now());
        List<AssetRecycle> assetRecycleList = new ArrayList<>();
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);

        Page<AssetRecycle> page_list = assetDataService.assetRecyclePage(periodDto);
        return new ResponseEntity<>(BaseResult.success("当期回收,获取成功").setData(page_list), HttpStatus.OK);
    }

    @ApiOperation(value = "当期购买",position = 3,notes =
                    "      \"number\": 编号,\n" +
                    "      \"buyer\": 债务人,\n" +
                    "      \"predict_date\": 应收账款日,\n" +
                    "      \"level\": 分级(1-正常 2-逾期 3-关注 4-次级 5-违约),\n" +
                    "      \"money_sum\": 回收款金额,\n" +
                    "      \"recycle_date\": 回收款日期\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/cycle/assetBuying")
    public ResponseEntity<BaseResult> assetBuying(@CurrentUser User user,PeriodDto periodDto) {
        AssetRecycle assetRecycle = new AssetRecycle();
        assetRecycle.setNumber("Ys20180811669");
        assetRecycle.setBuyer("湖南华润电力鲤鱼江");
//        assetRecycle.setLevel(1);
        assetRecycle.setPredict_date(LocalDate.now());
        assetRecycle.setMoney_sum(new BigDecimal(2422633.98));
        assetRecycle.setRecycle_date(LocalDate.now());
        List<AssetRecycle> assetRecycleList = new ArrayList<>();
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);
        assetRecycleList.add(assetRecycle);

        Page<AssetRecycle> page_list = assetDataService.assetBuyingPage(periodDto);
        return new ResponseEntity<>(BaseResult.success("当期购买,获取成功").setData(page_list), HttpStatus.OK);
    }

    @ApiOperation(value = "资产报告",position = 3,notes =
                    "    @ApiModelProperty(value=\"存续合同数\")\n" +
                    "    private int existenceContract;\n" +
                    "    @ApiModelProperty(value=\"期初存续合同数\")\n" +
                    "    private int existenceContract_beginning;\n" +
                    "    @ApiModelProperty(value=\"基础资产笔数\")\n" +
                    "    private int countBaseAsset;\n" +
                    "    @ApiModelProperty(value=\"期初基础资产笔数\")\n" +
                    "    private int countBaseAsset_beginning;\n" +
                    "    @ApiModelProperty(value=\"基础资产金额\")\n" +
                    "    private BigDecimal baseAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"期初基础资产金额\")\n" +
                    "    private BigDecimal baseAssetMoney_beginning;\n" +
                    "    @ApiModelProperty(value=\"逾期资产金额\")\n" +
                    "    private BigDecimal sumOverdueAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"逾期比例\")\n" +
                    "    private BigDecimal overdueRate;\n" +
                    "    @ApiModelProperty(value=\"闲置资金金额\")\n" +
                    "    private BigDecimal sumBreakAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"闲置比例\")\n" +
                    "    private BigDecimal breakRate;\n" +
                    "    @ApiModelProperty(value=\"闲置资金金额\")\n" +
                    "    private BigDecimal sumUnusedAssetMoney;\n" +
                    "    @ApiModelProperty(value=\"闲置比例\")\n" +
                    "    private BigDecimal unusedRate;" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/report/assetReport")
    public ResponseEntity<BaseResult> assetReport(@CurrentUser User user ,int period) {
        AssetReport assetReport = new AssetReport();

        return new ResponseEntity<>(BaseResult.success("资产报告,获取成功").setData(assetReport), HttpStatus.OK);
    }

    @ApiOperation(value = "当期发生",position = 3,notes =
            "      \"amount\": 金额,\n" +
                    "      \"amount_rate\": 金额占比,\n" +
                    "      \"count\": 笔数,\n" +
                    "      \"count_rate\": 笔数占比,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"event\": 事件,\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/cycle/currentHappen")
    public ResponseEntity<BaseResult> currentHappen(@CurrentUser User user,int period) {
        ReportRate reportRate = new ReportRate();
        reportRate.setAmount(new BigDecimal(34345.82));
        reportRate.setAmount_rate(new BigDecimal(43.87));
        reportRate.setCount(53);
        reportRate.setCount_rate(new BigDecimal(53.13));
        reportRate.setEvent("循环购买");
        List<ReportRate> list = new ArrayList<>();
        list.add(reportRate);
        list.add(reportRate);
        list.add(reportRate);
        return new ResponseEntity<>(BaseResult.success("当期发生,获取成功").setData(list), HttpStatus.OK);
    }

    @ApiOperation(value = "回收款",position = 3,notes =
                    "      \"amount\": 金额,\n" +
                    "      \"amount_rate\": 金额占比,\n" +
                    "      \"count\": 笔数,\n" +
                    "      \"count_rate\": 笔数占比,\n" +
                    "      -----------不同字段----------\n"+
                            "      \"cash_type\": 分类,\n" +
                            "      \"source\": 来源,\n" +
                            "      \"pay_type\": 支付方式,\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)"+
                    "      type(1:分类,2:来源,3:支付方式)")
    @GetMapping("/report/recycleAmount")
    public ResponseEntity<BaseResult> recycleAmount(@CurrentUser User user,int period,int type) {
        ReportRate reportRate = new ReportRate();
        reportRate.setAmount(new BigDecimal(34345.82));
        reportRate.setAmount_rate(new BigDecimal(43.87));
        reportRate.setCount(53);
        reportRate.setCount_rate(new BigDecimal(53.13));
        reportRate.setCash_type("提前回收款");
        reportRate.setSource("债务人回款");
        reportRate.setPay_type("现金或电汇");
        List<ReportRate> list = new ArrayList<>();
        list.add(reportRate);
        list.add(reportRate);
        list.add(reportRate);
        return new ResponseEntity<>(BaseResult.success("回收款,获取成功").setData(list), HttpStatus.OK);
    }

    @ApiOperation(value = "期末资产",position = 3,notes =
                    "      \"sum_money_sum\": 应收总金额,\n" +
                    "      \"sum_money_sum_rate\": 应收金额占比,\n" +
                    "      \"sum_available_money\": 应收余额,\n" +
                    "      \"sum_available_money_rate\": 应收余额占比,\n" +
                    "      \"asset_count\": 资产笔数,\n" +
                    "      \"asset_count_rate\": 资产笔数占比,\n" +
                    "      \"ave_available_money\": 平均每笔余额,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"asset_type\": 资产分类,\n" +
                    "      \"overdue_asset\": 逾期资产,\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)"+
                    "      type(1:资产分类,2:逾期资产)")
    @GetMapping("/report/endAsset")
    public ResponseEntity<BaseResult> endAsset(@CurrentUser User user,int period,int type) {
        BillAnalysis billAnalysis = new BillAnalysis();
        billAnalysis.setAsset_type("正常资产");
        billAnalysis.setOverdue_asset("逾期1-30天");
        List<BillAnalysis> list = new ArrayList<>();
        list.add(billAnalysis);
        list.add(billAnalysis);
        list.add(billAnalysis);
        return new ResponseEntity<>(BaseResult.success("期末资产,获取成功").setData(list), HttpStatus.OK);
    }

    @ApiOperation(value = "期末累计",position = 3,notes =
            "      \"amount\": 金额,\n" +
                    "      \"amount_rate\": 金额占比,\n" +
                    "      \"count\": 笔数,\n" +
                    "      \"count_rate\": 笔数占比,\n" +
                    "      -----------不同字段----------\n"+
                    "      \"acc_type\": 累计分类,\n" +
                    "      -----------参数----------\n"+
                    "      period(期数)")
    @GetMapping("/report/endAccumulate")
    public ResponseEntity<BaseResult> endAccumulate(@CurrentUser User user,int period) {
        ReportRate reportRate = new ReportRate();
        reportRate.setAmount(new BigDecimal(34345.82));
        reportRate.setAmount_rate(new BigDecimal(43.87));
        reportRate.setCount(53);
        reportRate.setCount_rate(new BigDecimal(53.13));
        reportRate.setAcc_type("累计逾期");
        List<ReportRate> list = new ArrayList<>();
        list.add(reportRate);
        list.add(reportRate);
        list.add(reportRate);
        return new ResponseEntity<>(BaseResult.success("期末累计,获取成功").setData(list), HttpStatus.OK);
    }
}
